#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>

typedef struct STU
{
	int iId;
	char caName[32];
	float fCScore;
	float fJavaScore;
}STU;

void init(STU *stu, int count)
{
	if (NULL == stu || count <= 0)
	{
		return;
	}
	int i = 0;
	for (; i<count; i++)
	{
		printf("请输入学生的信息id,name,cscore,javascore:\n");
		scanf("%d%s%f%f", &stu[i].iId, stu[i].caName
						, &stu[i].fCScore, &stu[i].fJavaScore);
	}	
}

void print(const STU *stu, int count)
{
	if (NULL == stu || count <= 0)
	{
		return;
	}
	int i = 0;
	for (; i<count; i++)
	{
		printf("id:%d, name:%s, cscore:%.1f, javascore=%.1f\n"
			   , stu[i].iId, stu[i].caName
			   , stu[i].fCScore, stu[i].fJavaScore);
	}
}

int main(void)
{
	STU *stu = (STU*)malloc(3*sizeof(STU));
	init(stu, 3);
	print(stu, 3);

	return 0;
}
